]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dateMenu: Port to GWeather 4.0
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 5 Jan 2022 02:18:08 +0000 (03:18 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 5 Jan 2022 03:07:25 +0000 (04:07 +0100)
Besides dropping its GTK dependency (which doesn't affect us),
GWeather 4.0 replaces its own timezone type with GTimeZone.

It's easy enough to adjust to that, so port over to the new
version.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2083>

.gitlab-ci.yml
js/ui/dateMenu.js
js/ui/environment.js

index b40419662a4a1f0c60f20d9cdf2c460b57207ec9..32eade1555f1f2f148e018be1b161771d8266167 100644 (file)
@@ -31,7 +31,7 @@ variables:
   LINT_LOG: "eslint-report.xml"
   LINT_MR_LOG: "eslint-mr-report.xml"
 
-image: registry.gitlab.gnome.org/gnome/mutter/fedora/34:x86_64-2021-09-15.0
+image: registry.gitlab.gnome.org/gnome/mutter/fedora/35:x86_64-2022-01-05.0
 
 workflow:
   rules:
index 6edd790a05847dfad6d11aadc5e54c36dd395691..89289179ba663d5ad0569ab2f546dc9927de83b7 100644 (file)
@@ -339,9 +339,13 @@ class WorldClocksSection extends St.Button {
                 this._locations.push({ location: l });
         }
 
+        const unixtime = GLib.DateTime.new_now_local().to_unix();
         this._locations.sort((a, b) => {
-            return a.location.get_timezone().get_offset() -
-                   b.location.get_timezone().get_offset();
+            const tzA = a.location.get_timezone();
+            const tzB = b.location.get_timezone();
+            const intA = tzA.find_interval(GLib.TimeType.STANDARD, unixtime);
+            const intB = tzA.find_interval(GLib.TimeType.STANDARD, unixtime);
+            return tzA.get_offset(intA) - tzB.get_offset(intB);
         });
 
         let layout = this._grid.layout_manager;
@@ -412,8 +416,9 @@ class WorldClocksSection extends St.Button {
     }
 
     _getTimezoneOffsetAtLocation(location) {
+        const tz = location.get_timezone();
         const localOffset = GLib.DateTime.new_now_local().get_utc_offset();
-        const utcOffset = this._getTimeAtLocation(location).get_utc_offset();
+        const utcOffset = GLib.DateTime.new_now(tz).get_utc_offset();
         const offsetCurrentTz = utcOffset - localOffset;
         const offsetHours = Math.abs(offsetCurrentTz) / GLib.TIME_SPAN_HOUR;
         const offsetMinutes =
@@ -427,15 +432,10 @@ class WorldClocksSection extends St.Button {
         return text;
     }
 
-    _getTimeAtLocation(location) {
-        let tz = GLib.TimeZone.new(location.get_timezone().get_tzid());
-        return GLib.DateTime.new_now(tz);
-    }
-
     _updateTimeLabels() {
         for (let i = 0; i < this._locations.length; i++) {
             let l = this._locations[i];
-            let now = this._getTimeAtLocation(l.location);
+            const now = GLib.DateTime.new_now(l.location.get_timezone());
             l.timeLabel.text = Util.formatTime(now, { timeOnly: true });
         }
     }
index ad2b8e4f281736745b7ece31848c1337d0ac8a94..67571152a61afe11dceb0a068cd90d9c4c21cc2f 100644 (file)
@@ -9,7 +9,7 @@ imports.gi.versions.GdkPixbuf = '2.0';
 imports.gi.versions.GnomeBluetooth = '1.0';
 imports.gi.versions.GnomeDesktop = '3.0';
 imports.gi.versions.Gtk = '3.0';
-imports.gi.versions.GWeather = '3.0';
+imports.gi.versions.GWeather = '4.0';
 imports.gi.versions.Soup = '3.0';
 imports.gi.versions.TelepathyGLib = '0.12';
 imports.gi.versions.TelepathyLogger = '0.2';